package com.realjinge.config;

import java.io.InputStream;
import java.util.Properties;

/** 微信公众账号开发者配置 */
public abstract class WeChatConfig {

	public static final String APPID;
	public static final String APPSECRET;
	public static final String TOKEN;
	public static final String WECHAT_ID;
	public static final String DOMAIN_NAME;

	static {
		try {
			InputStream in = WeChatConfig.class.getClassLoader().getResourceAsStream("config.properties");
			Properties props = new Properties();
			props.load(in);

			APPID = props.getProperty("appID", "");
			APPSECRET = props.getProperty("appsecret", "");
			TOKEN = props.getProperty("token", "");
			WECHAT_ID = props.getProperty("weChatID", "");
			DOMAIN_NAME = props.getProperty("domainName", "");
		} catch (Exception e) {
			e.printStackTrace();
			throw new RuntimeException("load config error " + e.getMessage());
		}
	}

	// 测试用
	public static void main(String[] args) {
		System.out.println(WeChatConfig.APPID);
		System.out.println(WeChatConfig.APPSECRET);
		System.out.println(WeChatConfig.TOKEN);
		System.out.println(WeChatConfig.WECHAT_ID);
		System.out.println(WeChatConfig.DOMAIN_NAME);
	}

}
